import Taro, { Component, Config } from "@tarojs/taro";
import { View, ScrollView, Image, Text } from "@tarojs/components";
import {IStoreProps} from '../../store/Stores'
import {getRuntime} from '../../utils/common'
import {toJS} from "mobx";


import './index.less'
import icon_37 from '../../assets/img/icon_41.png'
import icon_38 from '../../assets/img/icon_42.png'
import icon_39 from '../../assets/img/icon_43.png'
import icon_40 from '../../assets/img/icon_44.png'


import {inject, observer} from "@tarojs/mobx";
interface IHomeProps extends IStoreProps {}

@inject("stores")
@observer
class Company extends Component<IHomeProps>{
  constructor(){
    super()
  }

  componentWillMount(): void {
    Taro.setNavigationBarTitle({ title:'企业信用中心' })
  }

  handelRouter(url: string = '/pages/index/index'): void {
    if(!getRuntime().getToken()) { getRuntime().navigateTo('/pages/login/login'); return }
    getRuntime().navigateTo(url)
  }

  // 外链跳转
  link(url: string) {
    window.location.href = url
  }
  onScroll () {}
  render() {
    return(
     <View className='business-center'>
       <View className='business-theme'>
         <View className='theme theme-01' onClick={this.handelRouter.bind(this, '/pages/company_credit/page1')}>
           <View className='content'>
             <Image src={icon_37} className={'theme-icon'}/>
             <View className={'theme-info'}>
               <Text className='title'>ISO三大体系</Text>
               <Text className='num'>国际质量管理体系认证</Text>
             </View>
             <View className='btn-banli btn1'>立即办理></View>
           </View>
         </View>

         <View className='theme theme-02' onClick={this.handelRouter.bind(this, '/pages/company_credit/page2')}>
           <View className='content'>
             <Image src={icon_38} className={'theme-icon'}/>
             <View className={'theme-info'}>
               <Text className='title'>企业3A信用等级</Text>
               <Text className='num'>提升企业综合实力与竞争力</Text>
             </View>
             <View className='btn-banli btn2'>立即办理></View>
           </View>
         </View>

         <View className='theme theme-03'>
           <View className='content'>
             <Image src={icon_39} className={'theme-icon'}/>
             <View className={'theme-info'}>
               <Text className='title'>全网信用信息查询</Text>
               <Text className='num'>褒扬诚信 惩戒失信</Text>
             </View>
             <View className='btn-banli btn3' onClick={this.link.bind(this,'https://www.creditchina.gov.cn/')}>点击进入></View>
           </View>
         </View>

         <View className='theme theme-04'>
           <View className='content'>
             <Image src={icon_40} className={'theme-icon'}/>
             <View className={'theme-info'}>
               <Text className='title'>企查查</Text>
               <Text className='num'>企业信息查询工具</Text>
             </View>
             <View className='btn-banli btn4' onClick={this.link.bind(this,'https://m.qichacha.com/')}>点击进入></View>
           </View>
         </View>
       </View>
     </View>
    )
  }
}

export default Company
